package com.freewater.springboot.demo.ioc.lookupmethodinject.java8function;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 不同生命周期的对象相互依赖：singleton依赖prototype，使用Java8的Function实现依赖短生命周期的bean。
 */
@Slf4j
public class Main {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfiguration.class);
        log.info("使用ApplicationContext：{}", AppConfiguration.class);
        final CommandManager commandManager = applicationContext.getBean("commandManager", CommandManager.class);
        commandManager.process("hello");
        commandManager.process("world");
    }
}
